package edu.ynmd.lzk.action;

import  edu.ynmd.lzk.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import  edu.ynmd.lzk.model.StudentEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import  java.sql.Timestamp;

@Controller
public class PublicAction {
    @Autowired
    private StudentDao studentDao;



    @GetMapping("testDao")
    @ResponseBody
    public boolean testDao() throws Exception {
        //添加
       // StudentEntity student=new StudentEntity();
       //student.setStunum("201621447101");
       // student.setName("姓名");
        //student.setSex("F");
       //student.setBirthday(new Timestamp(System.currentTimeMillis()));
       //student.setNativeplace("云南玉溪");
       //studentDao.save(student);

        //修改
       //StudentEntity student=new StudentEntity();
        //student.setStudentid("67cee76f-72d9-4aa6-beb1-fdfef8aef380");
        //student.setStunum("201621447102");
       // student.setName("姓名修改");


        //查询单个
       //StudentEntity student=studentDao.findOne("67cee76f-72d9-4aa6-beb1-fdfef8aef380");
       //student.setSex("M");
      // student.setBirthday(new Timestamp(System.currentTimeMillis()));
        //student.setNativeplace("红塔区");


        //删除

        StudentEntity student=new StudentEntity();
        student.setStudentid("67cee76f-72d9-4aa6-beb1-fdfef8aef380");

        studentDao.save(student);
        return true;
    }


}
